package com.ljf.utility.api.service.impl;

import com.ljf.common.api.service.impl.NoDBBasisServiceImpl;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.result.ServiceResultModel;
import com.ljf.common.utils.ServiceResultUtil;
import com.ljf.utility.domain.service.CalculateDomainService;
import com.ljf.utility.domain.validator.CalculateValidator;
import com.ljf.utility.dto.other.CalculateMath;
import com.ljf.utility.service.ICalculateService;
import com.ljf.utility.vo.CalculateVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 计算器  服务接口实现
 *
 * @author LJF
 * @since 2024-08-11
 */
@Service
public class CalculateServiceImpl extends NoDBBasisServiceImpl<CalculateDomainService, CalculateValidator> implements ICalculateService {

    /**
     * 数学计算器接口
     *
     * @param model
     * @return
     * @throws ServiceException
     */
    @Override
    public ServiceResultModel<CalculateVO> mathCalculator(CalculateMath model) throws ServiceException {
        validator.checkMathCalculator(model);
        List<CalculateVO> resultList = domainService.mathCalculator(model);
        return ServiceResultUtil.success(resultList);
    }

}
